package com.songcha.library_business.proxy.weather



class WeatherManager {
    companion object{
        //default longitude and latitude is shanghai
        const val DEFAULT_LONGITUDE = 121.48941
        const val DEFAULT_LATITUDE = 31.40527
        const val DEFAULT_ADDRESS = "上海市"

        private var currentLongitude = DEFAULT_LONGITUDE
        private var currentLatitude = DEFAULT_LATITUDE
        private var currentAddress = DEFAULT_ADDRESS
        private var currentName = ""

      /*  private var lastLongitude = DEFAULT_LONGITUDE
        private var lastLatitude = DEFAULT_LATITUDE
        private var lastAddress = DEFAULT_ADDRESS
        private var lastName = ""*/

        var isGetLocationSuccess = false
        //private var currentCity = ""

        @JvmStatic
        fun setCurrentLocation(longitude:Double,latitude:Double){
            currentLongitude = longitude
            currentLatitude = latitude
        }

        @JvmStatic
        fun getCurrentAddress():String{
            return currentAddress
        }

        @JvmStatic
        fun setCurrentAddress(address:String){
            currentAddress = address
        }

        @JvmStatic
        fun getCurrentName():String{
            return currentName
        }

        @JvmStatic
        fun setCurrentName(name:String){
            currentName = name
        }

        /*@JvmStatic
        fun getCurrentCity():String{
            return currentCity
        }

        @JvmStatic
        fun setCurrentCity(city:String){
            currentCity = city
        }*/

        @JvmStatic
        fun getCurrentLongitude():Double{
            return currentLongitude
        }

        @JvmStatic
        fun getCurrentLatitude():Double{
            return currentLatitude
        }

        @JvmStatic
        fun setLocationResult(latitude:Double,longitude: Double,address:String?,name:String?){
            isGetLocationSuccess = true
            setCurrentLocation(longitude,latitude)
            setCurrentAddress(address ?: "未知")
            setCurrentName(name ?: "")
        }

       /* @JvmStatic
        fun saveLastLocationResult(){
            lastLatitude = currentLatitude
            lastLongitude = currentLongitude
            lastAddress = currentAddress
            lastName = currentName
        }*/

        @JvmStatic
        fun getShowAddress():String{
            if(currentName.isNotEmpty()){
                return currentName
            }else if(currentAddress.isNotEmpty()){
                return currentAddress
            }else{
                return "未知"
            }
        }

    }
}